package cn.lbwfree.web.Servlet;

import javax.servlet.*;
import java.io.IOException;
import java.util.Enumeration;


public class Myservlet implements Servlet {
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

        Enumeration<String> enumeration = servletConfig.getInitParameterNames();
        while(enumeration.hasMoreElements())
        {
            System.out.println(enumeration.nextElement());
        }
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
            System.out.println("调用MyServlet");
            servletResponse.setContentType("text/html;charset=UTF-8");
            servletResponse.getWriter().write("你好！");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("销毁");
    }
}
